﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;

namespace Project.Migrations
{
    public partial class InitialCreate : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_Test-Person",
                table: "Test-Person");

            migrationBuilder.RenameTable(
                name: "Test-Person",
                newName: "Test_Person");

            migrationBuilder.AddColumn<string>(
                name: "Birthday",
                table: "Test_Person",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Sex",
                table: "Test_Person",
                nullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_Test_Person",
                table: "Test_Person",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "Test_Dept",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Code = table.Column<string>(nullable: true),
                    Comment = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    PhoneNumber = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Test_Dept", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Test_Dept");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Test_Person",
                table: "Test_Person");

            migrationBuilder.DropColumn(
                name: "Birthday",
                table: "Test_Person");

            migrationBuilder.DropColumn(
                name: "Sex",
                table: "Test_Person");

            migrationBuilder.RenameTable(
                name: "Test_Person",
                newName: "Test-Person");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Test-Person",
                table: "Test-Person",
                column: "Id");
        }
    }
}
